cmake_minimum_required(VERSION 3.15)

project(GameEngineFromScratch VERSION 0.1.0)

IF(${UNIX})
    set (CMAKE_C_COMPILE                "clang")
    set (CMAKE_C_FLAGS_DEBUG            "-g")
    set (CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g")
    set (CMAKE_CXX_COMPILER             "clang++")
    set (CMAKE_CXX_FLAGS                "-Wall")
    set (CMAKE_CXX_FLAGS_DEBUG          "-g")
    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
ELSEIF(${WIN32})
    # Windows specific code
    set (CMAKE_C_COMPILER               "clang-cl")
    set (CMAKE_C_FLAGS_DEBUG            "/Debug /Zi")
    set (CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 /Debug")
    set (CMAKE_CXX_COMPILER             "clang-cl")
    set (CMAKE_CXX_FLAGS                "-Wall -Xclang")
    set (CMAKE_CXX_FLAGS_DEBUG          "/Debug /Zi")
    set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 /Debug")
ENDIF(${UNIX})

set (CMAKE_C_FLAGS                  "-Wall")
set (CMAKE_C_FLAGS_MINSIZEREL       "-Os -DNDEBUG")
set (CMAKE_C_FLAGS_RELEASE          "-O4 -DNDEBUG")
set (CMAKE_C_STANDARD 11)
set (CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
set (CMAKE_CXX_FLAGS_RELEASE        "-O4 -DNDEBUG")

set (CXX_STANDARD 20)
set (CXX_STANDARD_REQUIRED ON)
set (CXX_EXTENSIONS OFF)
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)



include_directories("${PROJECT_SOURCE_DIR}/Framework/Common")
include_directories("${PROJECT_SOURCE_DIR}/Framework/Interface")
include_directories("${PROJECT_SOURCE_DIR}/RHI")

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    include_directories("${PROJECT_SOURCE_DIR}/Platform/Linux")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
    include_directories("${PROJECT_SOURCE_DIR}/Platform/Darwin")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    include_directories("${PROJECT_SOURCE_DIR}/Platform/Windows")
endif()

add_subdirectory(Framework)
add_subdirectory(Platform)
add_subdirectory(RHI)
# add_subdirectory(Asset)